layui.use('table', function () {
    var table = layui.table;
    //第一个实例
    table.render({
        elem: '#records',
        url: '/record/queryList/', //数据接口
        page: true, //开启分页
        limits: [10, 20, 30],
        loading: true,
        unresize: true,
        align: 'center',
        cols: [[ //表头
            {field: 'id', title: 'ID', width: 80, sort: true},
            {field: 'paperName', title: '试卷', sort: true},
            {
                field: 'createTime',
                title: '考试时间',
                templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy-MM-dd HH:mm:ss')}}</div>"
            },
            {field: '', title: '分析报告', toolbar: '#reportBar'}
        ]]
    });
    /**
     * 监听工具栏
     */
    table.on('tool(record)', function (obj) {
        if (obj.event === 'toReport') {
            console.log(obj.data.id)
            window.open('/report/' + obj.data.id)
        }
    });

});
